home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
241_01
/
gettruth.ci
< prev
next >
Wrap
Text File
|
1987-08-29
|
2KB
|
94 lines
/*
HEADER: CUG241;
TITLE: Inference Engine for Expert System;
DATE: 12/30/85;
VERSION:
DESCRIPTION: "Source code for inference engine for an Expert System.";
KEYWORDS: Artificial Intelligence, expert systems, inference engine;
SYSTEM: MS-DOS or UNIX System V;
FILENAME: GETTRUTH.C;
WARNINGS: "User-supported, non-commercial"
AUTHORS: George Hageman;
COMPILERS: Microsoft C V3.00 or UNIX System V Portable C Compiler;
REFERENCES: ;
ENDREF
*/
/*****************************************************************
** **
** Inference -- (C) Copyright 1985 George Hageman **
** **
** user-supported software: **
** **
** George Hageman **
** P.O. Box 11234 **
** Boulder, Colorado 80302 **
** **
*****************************************************************/
/*************************************************
**
** getTruth(antecedent)
**
** asks user for the truth of a string or
** returns --
** TRUE if user says the statement is TRUE
** FALSE if the user says the statement is FALSE
**
*************************************************/
#include <stdio.h>
#ifdef MSDOS
#include <conio.h>
#endif
#include "expert.h"
#include "inference.h"
int getTruth(cnsquent)
int cnsquent ;
{
int done,c ;
done = FALSE ;
while(!done)
{
printf("\n Is the following statement True? (T/F,Y/N)\n\n ") ;
printf("%s ?",&strBuff[ruleBuff[cnsquent].string]) ;
#ifdef MSDOS
c = getche() ;
#endif
#ifdef UNIXSV
c = getchar() ;
getchar() ;
#endif
switch(c)
{
case 'y' :
case 'Y' :
case 't' :
case 'T' :
printf("\n\n") ;
return(TRUE) ;
case 'n' :
case 'N' :
case 'f' :
case 'F' :
printf("\n\n") ;
return(FALSE) ;
case 'w' :
case 'W' :
printf("\n Why is not implemented \n") ;
default :
printf("\n Please try again \"T\" or \"F\" \n ") ;
}
}
}